#include "func.h"

int main()
{
    char tmp[20];
    link *head = creat();
    read(head);
    while (1)
    {
        menu();
        printf("请选择操作:\t\n");
        printf("\tADD /SEE /SEARCH /DEL /UPDATE / EXIT :  ");
        scanf("%s", tmp);
        int num = change(tmp);
        if (num == 1)
        {
            insert(head);
        }
        else if (num == 2)
        {
            display(head);
        }
        else if (num == 3)
        {
            search(head);
        }
        else if (num == 4)
        {
            delete (head);
        }
        else if (num == 5)
        {
            update(head);
        }
        else if (num == 0)
        {
            save(head);
            exit(1);
        }
        else if (num == -1)
        {
            printf("非法输入，已强制退出！\n");
            break;
        }
    }
    return 0;
}